package cn.blunce.view_utils.ChartHelp;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cn.blunce.mylib.R;

public class DrawPic extends Activity implements View.OnClickListener {

    private Button mViewButton;
    private Button mActivityButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_draw_pic);
//        drawLine();

        initView();
    }

    private void initView() {
        mViewButton = (Button) findViewById(R.id.create_view);
        mActivityButton = (Button) findViewById(R.id.create_activity);

        mViewButton.setOnClickListener(this);
        mActivityButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.create_view:
                createView();
                break;
            case R.id.create_activity:
                createActivity();
                break;
            default:
        }
    }


    private void createView() {
        View view = ChartHelper.excuteView(this);
        new AlertDialog.Builder(this)
                .setTitle("显示折线图")
                .setView(view)
                .setPositiveButton("确定", null)
                .show();

    }

    private void createActivity() {
        Intent intent = ChartHelper.excuteActivity(this);
        startActivity(intent);
    }

    /*private void drawLine() {
        ChartView mChartView = (ChartView) findViewById(R.id.show_line);

        mChartView.setInfo(
                new String[]{"1", "2", "3", "4", "5", "6"},
                new String[]{"0", "5", "10"},
                new String[]{"3", "4", "7", "9", "5", "1"},
                "test"
        );
    }*/
}
